package org.jili.novoland.listener;

import org.jili.novoland.base.LayerManager;
import org.jili.novoland.game.ResourceManager;

import android.content.Context;
import android.view.MotionEvent;
import android.view.View;

public class TitleListener implements IControlListener {
    LayerManager layerManager;
    IControlListener nextControlListener = this;

    public TitleListener(Context ctx) {
        super();
        layerManager = new LayerManager();
        ResourceManager.getInstance(ctx).loadTitle(layerManager);

    }

    public boolean onTouch(View v, MotionEvent event) {
        int x = (int) event.getRawX();
        int y = (int) event.getRawY();

        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            break;
        case MotionEvent.ACTION_MOVE:
            break;
        case MotionEvent.ACTION_UP:
            int index = layerManager.getMenu().checkSelected(x, y);
            switch (index) {
            case 0:
                break;
            case 1:
                break;
            case 2:
                nextControlListener = new BattleListener(ResourceManager.getInstance().getContext());
                return false;
            default:
                break;
            }
            break;
        default:
            break;
        }

        return true;
    }

    @Override
    public LayerManager getLayerManager() {
        return layerManager;
    }

    @Override
    public IControlListener getNextControlListener() {
        return nextControlListener;
    }

}
